import { OnInit, Component, ViewChild } from '@angular/core';
import { EChartOption, graphic } from 'echarts';
import 'echarts/theme/macarons.js';
import { AcademicStatisticsListComponent } from './academic-statistics-list.component';
import { NzModalService } from 'ng-zorro-antd';

@Component({
  selector: 'app-academic-statistics-view',
  templateUrl: './academic-statistics-view.component.html',
  styles: [],
})
export class AcademicStatisticsViewComponent implements OnInit {
  constructor(private modalService: NzModalService) {}

  @ViewChild('academicStatisticsListComponent', { static: false })
  academicStatisticsListComponent: AcademicStatisticsListComponent;

  /**
   * 条件查询参数
   */
  queryParams = {
    studentName: null,
    grade: '',
    academyId: null,
    professionId: null,
    classId: null,
  };

  /**
   * 刷新
   */
  reflesh() {
    this.academicStatisticsListComponent.loadData();
  }

  /**
   * 查询
   */
  onSearch() {
    this.academicStatisticsListComponent.loadData();
  }

  /**
   * 重置表单
   */
  onResetForm() {
    this.queryParams.classId = null;
    this.queryParams.professionId = null;
    this.queryParams.academyId = null;
    this.queryParams.grade = '';
    this.queryParams.studentName = null;
  }

  download() {
    this.modalService.confirm({
      nzTitle: '导出',
      nzContent: `<p>导出为xlsx文件</p>`,
      nzOnOk: () => {
        this.academicStatisticsListComponent.download();
      },
    });
  }
  ngOnInit() {}
}
